package com.tongcheng.controller;

import com.tongcheng.ResultDate;
import com.tongcheng.feign.CouponsseviceFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;
@RestController
@CrossOrigin
public class CouponsController {
    @Autowired
    private CouponsseviceFeign couponsseviceFeign;
    @PostMapping(value = "/addCoupons",produces =  MediaType.APPLICATION_JSON_UTF8_VALUE)
    ResultDate addCoupons(Map map){
       return couponsseviceFeign.addCoupons(map);
    }
    @GetMapping(value = "/queryCouponsByactid",produces =  MediaType.APPLICATION_JSON_UTF8_VALUE)
    ResultDate queryCouponsByactid(Integer activity_id){
      return  couponsseviceFeign.queryCouponsByactid(activity_id);
    }
    @GetMapping(value = "/delCoupons",produces =  MediaType.APPLICATION_JSON_UTF8_VALUE)
    ResultDate delCoupons(Integer coupons_id){
        return couponsseviceFeign.delCoupons(coupons_id);
    }
    @GetMapping(value = "/queryCouponsByuserid",produces =  MediaType.APPLICATION_JSON_UTF8_VALUE)
    ResultDate queryCouponsByuserid(Integer userId){
        return couponsseviceFeign.queryCouponsByuserid(userId);
    }
    @PostMapping(value = "/updateCoupons",produces =  MediaType.APPLICATION_JSON_UTF8_VALUE)
    ResultDate updateCoupons(@RequestBody Map map){
       return couponsseviceFeign.updateCoupons(map);
    }
    @GetMapping(value = "/queryAllCoupons",produces =  MediaType.APPLICATION_JSON_UTF8_VALUE)
    ResultDate queryAllCoupons(){
        return couponsseviceFeign.queryAllCoupons();
    }
}
